const { default: axios } = require("axios");
const { parse_lyric } = require("./utiles/parse_lyric.js");
const Axios = require("axios");

Axios.get("http://123.207.32.32:9001/lyric?id=167888").then(res => {
  let lyric = res.data.lrc.lyric;

  // let lyricInfoArray = [];

  // let lyricMsg = lyric.split("\n");

  // lyricMsg.forEach(item => {
  //   let lyricInfo;
  //   let res = item.match(/\[(\d{2}):(\d{2})\.(\d{2,3})\]/i); //加上全局的g 而不是is就是拿到完整到拿不到分组
  //   let text = item.replace(/\[(\d{2}):(\d{2})\.(\d{2,3})\]/i, "");
  //   if (!res) return;

  //   let minTime = res[1] * 60 * 1000;
  //   let secTime = res[2] * 1000;
  //   let mileTime = res[3].length == 2 ? res[3] + "0" : res[3];
  //   let sumTime = minTime + secTime + mileTime;

  //   lyricInfo = { sumTime, text };
  //   lyricInfoArray.push(lyricInfo);

  //   // console.log("i", res[1]);
  //   // console.log(minTime);

  //   // console.log("i", mileTime);
  //   // console.log(sumTime);
  // });

  //将上面的代码封装
  let info = parse_lyric(lyric);
  console.log(info);
});
